package a2023.a1024;

/**
 * @author lenovo
 * @date 2023/10/24
 */
public class a {
    private static final int MOD = 1000000007;
    public static void main(String[] args) {
        System.out.println(numRollsToTarget(3, 11, 20));
    }

    public static int numRollsToTarget(int n, int k, int target) {
        int[][] dp = new int[31][1001];
        int min = Math.min(k, target);
        for (int i = 1; i <= min; i++) {
            dp[1][i] = 1;
        }
        int targetMax = n * k;
        for (int i = 2; i <= n; i++) {
            for (int j = i; j <= targetMax; j++) {
                for (int l = 1; j - l >= 0 && l <= k; l++) {
                    dp[i][j] = (dp[i][j] + dp[i - 1][j - l]) % MOD;
                }
            }
        }
        return dp[n][target];
    }
}
